/**
 * 
 */
package com.anxin.controller.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.anxin.common.utils.JsonResult;
import com.anxin.common.utils.RequestUtils;
import com.anxin.views.RecentAttackTypeView;
import com.anxin.views.RecentInterceptSourceView;
import com.anxin.views.RectifyView;
import com.anxin.views.ResourceView;
import com.anxin.views.SecureDetailView;
import com.anxin.views.SecureLevelView;
import com.anxin.views.SecureSituationView;
import com.anxin.views.TodayAttackUnitView;
import com.anxin.views.UnitView;
import com.anxin.views.WebSecureDetailView;

/**
 * @author sj
 *
 */
@Controller
public class HomeController {

	private Logger logger = LoggerFactory.getLogger(HomeController.class);

	@RequestMapping(value = "/PostSecureSituation", method = RequestMethod.POST)
	@ResponseBody
	public JsonResult PostSecureSituation(HttpServletRequest request, HttpServletResponse response, Model model,
			@RequestParam(value = "secureIndex", required = false) String secureIndex) {
		logger.info(RequestUtils.getAllRequestParam(request));
		List<SecureSituationView> list = JSONArray.parseArray(secureIndex, SecureSituationView.class);
		 
		
		return new JsonResult();
	}

	@RequestMapping(value = "/PostInterceptAttackDetail", method = RequestMethod.POST)
	@ResponseBody
	public JsonResult PostInterceptAttackDetail(HttpServletRequest request, HttpServletResponse response, Model model,
			@RequestParam(value = "date", required = false) String date,
			@RequestParam(value = "recentAttackTypeList", required = false) String recentAttackTypeList,
			@RequestParam(value = "todayAttackUnitList", required = false) String todayAttackUnitList,
			@RequestParam(value = "recentInterceptSourceList", required = false) String recentInterceptSourceList) {
		logger.info(RequestUtils.getAllRequestParam(request));

		List<RecentAttackTypeView> recentAttackTypeViewList = JSONArray.parseArray(recentAttackTypeList,
				RecentAttackTypeView.class);
		List<TodayAttackUnitView> todayAttackUnitViewList = JSONArray.parseArray(todayAttackUnitList,
				TodayAttackUnitView.class);
		List<RecentInterceptSourceView> recentInterceptSourceViewList = JSONArray.parseArray(recentInterceptSourceList,
				RecentInterceptSourceView.class);

		return new JsonResult();
	}

	@RequestMapping(value = "/PostSecureLevel", method = RequestMethod.POST)
	@ResponseBody
	public JsonResult PostSecureLevel(HttpServletRequest request, HttpServletResponse response, Model model,
			@RequestParam(value = "secureLevel", required = false) String secureLevel) {
		logger.info(RequestUtils.getAllRequestParam(request));
		List<SecureLevelView> secureLevelList= JSONArray.parseArray(secureLevel,
				SecureLevelView.class);
		
		return new JsonResult();
	}

	@RequestMapping(value = "/PostRectify", method = RequestMethod.POST)
	@ResponseBody
	public JsonResult PostRectify(HttpServletRequest request, HttpServletResponse response, Model model,
			@RequestParam(value = "rectify", required = false) String rectify) {
		logger.info(RequestUtils.getAllRequestParam(request));
		 List<RectifyView> rectifyList= JSONArray.parseArray(rectify,
				 RectifyView.class);
		return new JsonResult();
	}

	@RequestMapping(value = "/LoadIPAssetsSecureDetail", method = RequestMethod.POST)
	@ResponseBody
	public JsonResult LoadIPAssetsSecureDetail(HttpServletRequest request, HttpServletResponse response, Model model,
			@RequestParam(value = "secureDetail", required = false) String secureDetail) {
		logger.info(RequestUtils.getAllRequestParam(request));
		
		List<SecureDetailView> secureDetailList=JSONArray.parseArray(secureDetail,
				SecureDetailView.class);
		return new JsonResult();
	}

	@RequestMapping(value = "/PostWebSecureDetail", method = RequestMethod.POST)
	@ResponseBody
	public JsonResult PostWebSecureDetail(HttpServletRequest request, HttpServletResponse response, Model model,
			@RequestParam(value = "webSecureDetail", required = false) String webSecureDetail) {
		logger.info(RequestUtils.getAllRequestParam(request));
		List<WebSecureDetailView> webSecureDetailList=JSONArray.parseArray(webSecureDetail,
				WebSecureDetailView.class);
		return new JsonResult();
	}

	@RequestMapping(value = "/PostResource", method = RequestMethod.POST)
	@ResponseBody
	public JsonResult PostResource(HttpServletRequest request, HttpServletResponse response, Model model,
			@RequestParam(value = "resource", required = false) String resource) {
		logger.info(RequestUtils.getAllRequestParam(request));
		List<ResourceView> resourceList=JSONArray.parseArray(resource,
				ResourceView.class);
		return new JsonResult();
	}

	@RequestMapping(value = "/PostUnitList", method = RequestMethod.POST)
	@ResponseBody
	public JsonResult PostUnitList(HttpServletRequest request, HttpServletResponse response, Model model,
			@RequestParam(value = "unitList", required = false) String unitList) {
		logger.info(RequestUtils.getAllRequestParam(request));
		List<UnitView> list=JSONArray.parseArray(unitList,
				UnitView.class);
		
		
		
		
		return new JsonResult();
	}
}
